package com.itwenke.springbootdemo.shirowebboot.controller;

import com.itwenke.springbootdemo.shirowebboot.session.RedisSessionDAO;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.apache.shiro.session.Session;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

@RestController
@RequestMapping("/test")
public class TestController {

    @Resource
    private RedisSessionDAO redisSessionDAO;

    @GetMapping("/select")
    public String select(){
        redisSessionDAO.getActiveSessions();
        return "item Select!!!";
    }

    @GetMapping("/delete")
    public String delete(){
        return "item Delete!!!";
    }

    @GetMapping("/update")
    @RequiresRoles(value = {"超级管理员","运营管理员"})
    public String update(){
        return "item Update!!!";
    }

    @GetMapping("/insert")
    @RequiresRoles(value = {"超级管理员","运营管理员"}, logical = Logical.OR)
    public String insert(){
        return "item Update!!!";
    }

    @GetMapping("/rememberMe")
    public String rememberMe(){
        return "rememberMe!!!";
    }

    @GetMapping("/authentication")
    public String authentication(){
        return "authentication!!!";
    }
}
